feat(core): implement file-based remote function register #829
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
When planning a SQL, DataFusion planner will strictly check the function usage. The used function should be registered in the SessionContext. In the Wren AI scenario, we always fully push down the SQL to the data source side. We can invoke the
ByPassFunction
(introduced by #802) which only requires the function name and return type to register a logical function for unparsing purposes.This PR introduces a file-based register to define the required remote function easily.
Definition File
The definition file is a CSV file that contains 4 columns and with the header:
function_type
: The possible value containsscalar
,aggregate
, andwindow
. All of them are lowercase.name
: The function name.return_type
: The expected return type.description
: A simple description of this function. Because the description could contain a comma, we should quote the value.Sample
Set up the config
On the ibis server side, we add a new environment variable called
REMOTE_FUNCTION_LIST_PATH
which is the path of the definition file. We should set up it before starting the server.Known Issue